package z.thread;

public class ThreadApi {
    public static void main(String[] args) {
        Thread main = Thread.currentThread();
        System.out.println(main);
        dosome();

    }
    public static void dosome(){
        Thread t=Thread.currentThread();
        System.out.println("执行这个方法的线程是:"+t);
        String name = t.getName();
        System.out.println("线程的名字是:"+name);
        long id = t.getId();
        System.out.println("线程的id是:"+id);
        int priority = t.getPriority();
        System.out.println("线程的优先级是:"+priority);
        boolean daemon = t.isDaemon();
        System.out.println("线程是否是守护线程:"+daemon);
        boolean interrupted = t.isInterrupted();
        System.out.println("线程是否被中断:"+interrupted);
        boolean alive = t.isAlive();
        System.out.println("线程是否存活:"+alive);
    }
}
